// 引入Service和请求头ServiceName
import { Service, ServiceName } from '@/network/http.js'
import store from '@/store/index.js' // 引入store

const api = {
  /**
     * 获取数据
     */
  getData(params) {
    return Service.get(
      `/${ServiceName}/api/external/TShipVoyageController/queryall`, { params }
    )
  },
  /**
     * 根据id查询船舶作业报告
     */
  getDataById(id) {
    return Service.get(
      `/${ServiceName}/api/external/TShipVoyageController/querybyid?id=${id}`
    )
  },
  /**
     * 修改船舶作业报告
     */
  dataUpdate(params) {
    store.commit('changeStatus', true)
    return Service.put(
      `/${ServiceName}/api/external/TShipVoyageController/update`,params
    )
  },
  /**
     * 根据id查询杂项作业报告
     */
  getSundryDataById(id) {
    return Service.get(
      `/${ServiceName}/api/external/TShipVoyageController/queryby?id=${id}`
    )
  },
  /**
     * 保存杂项作业报告
     */
  saveSundryDataById(params) {
    store.commit('changeStatus', true)
    return Service.post(
      `/${ServiceName}/api/external/TShipVoyageController/insert`, params
    )
  },
  /**
     * 查询停工记录
     */
  getStopRecord(shipvoyageId) {
    return Service.get(
      `/${ServiceName}/api/external/TShipVoyageController/getShipStopDynamicById?shipvoyageId=${shipvoyageId}`
    )
  },
}
export default api
